package org.swan.web.role.mapper;

import org.apache.ibatis.annotations.*;
import org.swan.web.role.bean.RoleBean;
import java.util.List;
import java.util.Optional;


public interface RoleMapper {
    @Insert("insert into role ( name , description , namespace_id ) VALUES ( #{name} , #{description} , #{namespaceId})")
    @Options(useGeneratedKeys = true,keyProperty = "roleId")
    long add(RoleBean ub);
    @Select("select * from role where role_id = #{id}")
    Optional<RoleBean> getById(@Param("id") long id);
    @Update("update role set name = #{name} ,description = #{description}  where role_id = #{roleId}  ")
    long updateById(RoleBean RoleBean);
    @Delete("delete from role where role_id = #{RoleId}")
    long deleteById(@Param("RoleId") long RoleId);
    @Select("select * from role limit #{rows} offset #{offset}")
    List<RoleBean> list(@Param("offset") int offset,@Param("rows") int rows);
}
